com.supermap.data

Class Dataset

  • java.lang.Object
    • com.supermap.data.Dataset
  • Direct Known Subclasses:
    DatasetGrid, DatasetImage, DatasetVector


    public abstract class Dataset
    extends java.lang.Object

    The base class of all the classes of datasets with different types, such as the DatasetVector, DatasetGrid etc., that provides common methods, and events.

    A dataset is a collection of related data stored together. According to the types of data, there are vector dataset, raster dataset and image dataset, and the dataset designed for specific problems, such as topology dataset, network dataset etc. A vector dataset is a collection of related data stored together. The vector dataset is a collection of spatial features with the same type, and it is also called a feature set. For different features may have different spatial representations, the vector dataset includes point dataset, line dataset, region dataset and so on, and the features with the same spatial representation and function will be organized together. Raster datasets, composed of arrays of cells, have advantage in the presentation of the spatial relationships of features.

    Currently supported datasets include point datasets, line datasets, region datasets, text datasets, tabular dataset, LineM Datasets, network datasets, tabular datasets, and image datasets.

    Calls the Workspace.dispose()method after operate the dataset, or the changes can't be saves.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Used to close the current dataset.
      Rectangle2D getBounds()
      Gets the boundary rectangle that contains all geometric objects in this dataset.
      Datasource getDatasource()
      Returns the datasource object that contains this dataset.
      java.lang.String getDescription()
      Returns the additional information added for the dataset.
      EncodeType getEncodeType()
      Using a encoding for a dataset can reduce the space used to store this dataset, decrease the load of the net or the load of the server.
      DatasetGroup getGroup()
      Get the grouping in which the dataset is located
      java.lang.String getName()
      Returns the name of this dataset.
      PrjCoordSys getPrjCoordSys()
      Returns the projection information of the dataset.
      java.lang.String getTableName()
      For database-based data sources, the name of the data table corresponding to the dataset in the database is returned, and for file-based data sources, the table name of the storage attribute of the dataset is returned (.udb file storage space data for file-based data source files, and .udd file for property data).
      DatasetType getType()
      Return the type of the dataset.
      boolean isOpen()
      After the datasource that contains this dataset connects to data, that is, the datasource is opened, by default, the dataset is not opened.
      boolean isReadOnly()
      Returns whether the current dataset is readOnly.
      boolean open()
      Used to open dataset.
      void setDescription(java.lang.String value)
      Sets the description about this dataset added by the user.
      void setName(java.lang.String name)
      set the Dataset name
      void setPrjCoordSys(PrjCoordSys prjCoordSys)
      Sets the projection information of the dataset.
      void setReadOnly(boolean readOnly)
      Sets whether the data set is read-only.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getBounds

        public Rectangle2D getBounds()
        Gets the boundary rectangle that contains all geometric objects in this dataset. For a vector dataset, it is the dataset is the minimum bounding box of all features in the dataset. For a raster dataset, the bounds of the dataset is the geographical extent of the grid or image dataset.
        Returns:
        the boundary rectangle that contains all geometric objects in this dataset.
      • isReadOnly

        public boolean isReadOnly()
        Returns whether the current dataset is readOnly.
        1. If the datasource this dataset belongs to is opened in read-only manner, this method will return true, and this dataset is not allowed to be modified.
          • It is not allowed to added , deleted and modified for vector dataset; DatasetVector
            It is not allowed to set the pixel value for image dataset;DatasetImage
        2. If the datasource is not opened as readOnly, but the dataset is set as readonly, the dataset can't be changed, return true.
        Returns:
        a boolean, indicate whether the current dataset is readonly.
        See Also:
        open()
        Example:
        See the sample of Dataset.open() method.
      • isOpen

        public boolean isOpen()
        After the datasource that contains this dataset connects to data, that is, the datasource is opened, by default, the dataset is not opened. If you want to access or do some operations on the data in this dataset, you need to first open this dataset; otherwise, you can not operate on the data of it. You can determine whether this dataset is opened using this method.
        Returns:
        Returns true if the dataset has been opened.
        See Also:
        open()
        Example:
        See the sample of Dataset.open() method.
      • getDatasource

        public Datasource getDatasource()
        Returns the datasource object that contains this dataset.
        Returns:
        the datasource object that contains this dataset.
      • getDescription

        public java.lang.String getDescription()
        Returns the additional information added for the dataset.
        Returns:
        the description information added for the dataset.
      • setDescription

        public void setDescription(java.lang.String value)
        Sets the description about this dataset added by the user.
        Parameters:
        value - the description information added for the dataset.
        Example:
        The following example demonstrates how to write the dataset description for a dataset.
         public void setDescriptionTest() {
                // Imagines that you open a workspace object, and there is a database datasource object in the workspace
                // Get the dataset from datasource, and write the description information for the dataset
                Dataset dataset = datasource.getDatasets().get("World");
                dataset.setDescription("World");
                String description = dataset.getDescription();
                System.out.println("The description information for dataset is: " + description);
            }
         
      • getName

        public java.lang.String getName()
        Returns the name of this dataset. The name is the unique identifier of the dataset. The identifier is not case-sensitive.
        Returns:
        the specified name of the image dataset.
      • getType

        public DatasetType getType()
        Return the type of the dataset. The dataset type supported in the current version includes tabular dataset, point dataset, line dataset, region dataset, text dataset and image dataset.
        Returns:
        the type of the source vector dataset.
      • getEncodeType

        public EncodeType getEncodeType()
        Using a encoding for a dataset can reduce the space used to store this dataset, decrease the load of the net or the load of the server. The encoding type for the vector dataset can be Byte, Int16, Int24 and Int32, SGL,LZW,DCT, or you can choose not to encode or compress this dataset, which is None. The encoding type of the raster dataset can be DCT, SGL, LZW or None, which means do not compress the data.For more information, please refer to the EncodeType class.
        Returns:
        the encoding type of this dataset.
        See Also:
        EncodeType
      • getPrjCoordSys

        public PrjCoordSys getPrjCoordSys()
        Returns the projection information of the dataset.
        • Return null if the dataset use the projection of the datasource that contains it.
        Returns:
        the projection information of the datasource.
        Example:
        The following example demonstrates how to check the projection of a dataset.
         public void getPrjCoordSysTest() {
                // Imagines that you open a workspace object, and there is a database datasource object in the workspace
                // Get the dataset from datasource, and see the projection of the dataset
                Dataset dataset = datasource.getDatasets().get("World");
                PrjCoordSys prjCoordSys = dataset.getPrjCoordSys();
            }
         
      • setPrjCoordSys

        public void setPrjCoordSys(PrjCoordSys prjCoordSys)
        Sets the projection information of the dataset.
        • Return null if the dataset use the projection of the datasource that contains it.
        Parameters:
        prjCoordSys - the projection information of the dataset.
      • close

        public void close()
        Used to close the current dataset. For vector dataset, all the recordset will be released after call this method.
        Example:
        See the sample of Dataset.open() method.
      • open

        public boolean open()
        Used to open dataset. After the datasource that contains this dataset connects to data, that is, the datasource is opened, by default, the dataset is not opened. If you want to access or do some operations on the data in this dataset, you need to first open this dataset; otherwise, you can not operate on the data of it. You can determine whether this dataset is opened using this method.

        Therefore: You need to call Dataset.open() method to open the dataset before performing any operations on the dataset.

        Returns:
        Retures true if successful; otherwise, returns false.
        Example:
        the following codes demonstrates how to open dataset.
         public void openTest() {
                        // Imagines that you open a workspace object, and there is a database datasource object in the workspace
                // Get the dataset from datasource, and open it and set it read-only
        
                Dataset dataset = datasource.getDatasets().get("World");
                dataset.open();
                if (dataset.isOpen()) {
                    System.out.println("It is succeed to open the dataset");
                    // Determines whether the dataset is read-only
                    if (dataset.isReadOnly()) {
                        System.out.println("The dataset is read-only");
                    } else {
                        // If it isn't read-only, set it to be read-only
                        dataset.setReadOnly(true);
                    }
                    dataset.close();
                }
            }
         
      • setReadOnly

        public void setReadOnly(boolean readOnly)
        Sets whether the data set is read-only.
        Parameters:
        readOnly - Ture,sets the dataset is read-only.
      • setName

        public void setName(java.lang.String name)
        set the Dataset name
        Parameters:
        name - the Dataset name
      • getTableName

        public java.lang.String getTableName()
        For database-based data sources, the name of the data table corresponding to the dataset in the database is returned, and for file-based data sources, the table name of the storage attribute of the dataset is returned (.udb file storage space data for file-based data source files, and .udd file for property data).
        Returns:
        The name of the data table corresponding to the database data source or the table name of the storage attribute of the file data source.
      • getGroup

        public DatasetGroup getGroup()
        Get the grouping in which the dataset is located
        Returns:
        The grouping in which the dataset is located